package com.ruoyi.cases.service.impl;

import java.util.List;

import cn.hutool.core.util.IdUtil;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.mapper.SysUserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.cases.mapper.JlStatisticsMouthMapper;
import com.ruoyi.cases.domain.JlStatisticsMouth;
import com.ruoyi.cases.service.IJlStatisticsMouthService;

/**
 * 月统计Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-05-23
 */
@Service
public class JlStatisticsMouthServiceImpl implements IJlStatisticsMouthService 
{
    @Autowired
    private JlStatisticsMouthMapper jlStatisticsMouthMapper;
    @Autowired
    private SysUserMapper sysUserMapper;

    /**
     * 查询月统计
     * 
     * @param id 月统计主键
     * @return 月统计
     */
    @Override
    public JlStatisticsMouth selectJlStatisticsMouthById(String id)
    {
        return jlStatisticsMouthMapper.selectJlStatisticsMouthById(id);
    }

    /**
     * 查询月统计列表
     * 
     * @param jlStatisticsMouth 月统计
     * @return 月统计
     */
    @Override
    public List<JlStatisticsMouth> selectJlStatisticsMouthList(JlStatisticsMouth jlStatisticsMouth)
    {
        List<JlStatisticsMouth> list = jlStatisticsMouthMapper.selectJlStatisticsMouthList(jlStatisticsMouth);
        return list;
    }

    /**
     * 新增月统计
     * 
     * @param jlStatisticsMouth 月统计
     * @return 结果
     */
    @Override
    public int insertJlStatisticsMouth(JlStatisticsMouth jlStatisticsMouth)
    {
        /*设置审核用户信息*/
        LoginUser loginUser = SecurityUtils.getLoginUser();
        jlStatisticsMouth.setAuditUser(String.valueOf(loginUser.getUserId()));
        jlStatisticsMouth.setId(String.valueOf(IdUtil.getSnowflake().nextId()));
        jlStatisticsMouth.setAuditUsername(sysUserMapper.selectUserById(loginUser.getUserId()).getNickName());
        return jlStatisticsMouthMapper.insertJlStatisticsMouth(jlStatisticsMouth);
    }

    /**
     * 修改月统计
     * 
     * @param jlStatisticsMouth 月统计
     * @return 结果
     */
    @Override
    public int updateJlStatisticsMouth(JlStatisticsMouth jlStatisticsMouth)
    {
        return jlStatisticsMouthMapper.updateJlStatisticsMouth(jlStatisticsMouth);
    }

    /**
     * 批量删除月统计
     * 
     * @param ids 需要删除的月统计主键
     * @return 结果
     */
    @Override
    public int deleteJlStatisticsMouthByIds(String[] ids)
    {
        return jlStatisticsMouthMapper.deleteJlStatisticsMouthByIds(ids);
    }

    /**
     * 删除月统计信息
     * 
     * @param id 月统计主键
     * @return 结果
     */
    @Override
    public int deleteJlStatisticsMouthById(String id)
    {
        return jlStatisticsMouthMapper.deleteJlStatisticsMouthById(id);
    }
}
